<template>
  <button :action="action" @click="compute">{{ innerText }}</button>
</template>

<script>
export default {
  name: "CounterButton",
  props: {
    action: String,
    innerText: String,
  },
  methods: {
    compute() {
      //vue2.x 自定义事件的方式向父组件传递
      // this.$emit("compute", this.action);

      //派发器的方式
      this.$emit("dispatch", this.action);
    },
  },
};
</script>